﻿<navigation:Page xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
  x:Class="TheCollectiveNetwork.Views.Administration.UserManagement" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:CustomControls="clr-namespace:TheCollectiveNetwork.CustomControls"  
  mc:Ignorable="d" d:DesignWidth="980" d:DesignHeight="600"  
  Style="{StaticResource PageStyle}" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:TheCollectiveNetwork.Web.Services" xmlns:my1="clr-namespace:TCNDataAccessLayer">

    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" >
            <controlsToolkit:DockPanel Background="White" LastChildFill="True">

                <TextBlock x:Name="HeaderText" controlsToolkit:DockPanel.Dock="Top"   Style="{StaticResource HeaderTextStyle}" Text="{Binding Path=ApplicationStrings.UserManagementTitle, Source={StaticResource ResourceWrapper}}"/>

                <Grid x:Name="UserManagementGrid"  VerticalAlignment="Top">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="10*" />
                        <RowDefinition Height="90*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100*" />                       
                    </Grid.ColumnDefinitions>
                    <StackPanel x:Name="UserManagementSearchPanel" Grid.Row="0" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Bottom">
                        <TextBlock Style="{StaticResource ContentTextStyle}" Margin="5,0,0,0" Text="Search" Height="25" VerticalAlignment="Bottom"/>
                        <TextBox Text="" Name="usersearchtextbox" Width="200" Height="25" Margin="5"/>
                        <Button x:Name="UserSearchBtn" Click="UserSearchBtn_Click" Content="Find first 50 results" Width="150" Height="25" Margin="5" />

                    </StackPanel>

                    <StackPanel x:Name="UserManagementResultsPanel" Grid.Row="1" Grid.Column="0" Margin="10"  >
                        <sdk:DataPager x:Name="UserListDataPager"  PageSize="15" DisplayMode="PreviousNext" Margin="0,5,0,0" Background="#FFFFFFFF" BorderThickness="0"/>

                        <sdk:DataGrid x:Name="UserListDataGrid" Margin="0" AutoGenerateColumns="False" HeadersVisibility="Column" BorderThickness="0" GridLinesVisibility="Horizontal" SelectionMode="Single" IsReadOnly="true" >
                            <sdk:DataGrid.CellStyle>
                                <Style TargetType="sdk:DataGridCell">
                                    <Setter Property="Background" Value="#FFEEFFED"/>
                                </Style>
                            </sdk:DataGrid.CellStyle>
                            <sdk:DataGrid.Columns >
                                <sdk:DataGridTextColumn Header="User Name" Binding="{Binding username, Mode=OneTime}" />
                                <sdk:DataGridTextColumn Header="Organisation" Binding="{Binding organisation, Mode=OneTime}" />
                                <sdk:DataGridTextColumn Header="First Name" Binding="{Binding first_name, Mode=OneTime}" />
                                <sdk:DataGridTextColumn Header="Last Name" Binding="{Binding last_name, Mode=OneTime}" />
                                <sdk:DataGridTextColumn Header="Phone" Binding="{Binding phone_number, Mode=OneTime}" />
                                <sdk:DataGridTemplateColumn Width="150" Header="" >                                   
                                    <sdk:DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Margin="5" VerticalAlignment="Top"  HorizontalAlignment="Right" Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
                                                <CustomControls:GuidButton x:Name="UserEditBtn" Content="Edit"  GuidID="{Binding User_GUID, Mode=OneWay}"  Click="UserEditBtn_Click" Width="60" Height="25" Margin="0,0,5,0"/>
                                                <CustomControls:GuidButton x:Name="UserDeleteBtn" Content="Delete"  GuidID="{Binding User_GUID, Mode=OneWay}"  Click="UserDeleteBtn_Click" Width="60" Height="25" Foreground="#FFD11800"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </sdk:DataGridTemplateColumn.CellTemplate>
                                </sdk:DataGridTemplateColumn>
                            </sdk:DataGrid.Columns>

                        </sdk:DataGrid>

                    </StackPanel>                   
                </Grid>
            </controlsToolkit:DockPanel>
        </ScrollViewer>

    </Grid>

</navigation:Page>